package com.joysuch.wwyt.api.mh.repository;

import com.joysuch.wwyt.api.mh.entity.MhPlatformPoint;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

public interface MhPlatformPointDao extends JpaRepository<MhPlatformPoint, Long> {
    List<MhPlatformPoint> findByPlatformId(Long id);

    List<MhPlatformPoint> findByPlatformIdAndSwitchState(Long platformId, Integer switchState);

    @Query(value = "SELECT point_code FROM wwyt_mh_platform_point WHERE delete_flag='0' AND platform_id = ?1", nativeQuery = true)
    List<String> getPointCodeByPlatformId(Long platformId);

    List<MhPlatformPoint> findByPointId(Long id);

    MhPlatformPoint findByPointCode(String pointCode);
}
